//
//  CGQxiangmuchoiceCell.swift
//  SheYangBigData
//
//  Created by 叁拾叁 on 2021/4/7.
//  Copyright © 2021 叁拾叁. All rights reserved.
//


import UIKit


class CGQxiangmuchoiceCell: SYBaseCell {

    
    let title: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x333333)
        v.font = 14.autoFontSize()
        v.text = "设备离线"
        v.numberOfLines = 0 
        return v
    }()
    
    let pic: UIImageView = {
        let v: UIImageView = UIImageView()
        v.sy_name("xiangmu_icon")
        return v
    }()
    
    let choice: UIImageView = {
        let v = UIImageView()
        v.image = UIImage(named: "xiangmu_choice")
        v.isHidden = true
        return v
    }()
    
    public func configureView(model: NSRecordsModel) {
//        title.text = model.name
//        if let p = model.imgPath {
//            pic.kf.setImage(with: URL(string: IMGIP+p))
//        }
        title.text = model.appName
    }
    public func shebeiconfigureView(model: CGQduankouModel) {
//        title.text = model.name
//        if let p = model.imgPath {
//            pic.kf.setImage(with: URL(string: IMGIP+p))
//        }
        
        title.text = model.portName
    }
    
    public func shebeiTypeconfigureView(model: CGQduankouModel) {
//        title.text = model.name
//        if let p = model.imgPath {
//            pic.kf.setImage(with: URL(string: IMGIP+p))
//        }
        
        title.text = model.protocolDeviceTypeName
    }
    
    override func initViews() {
        
        self.backgroundColor = .white
        
        addSubview(pic)
        addSubview(title)
        addSubview(lineView)
        addSubview(choice)
        
        pic.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.left.equalToSuperview().offset(autoWidth(10))
            make.width.equalTo(18.autoWidth())
            make.height.equalTo(18.autoWidth())

        }
        title.snp.makeConstraints { (make) in
//            make.centerY.equalToSuperview()
            make.top.equalToSuperview().offset(18.autoWidth())
            make.bottom.equalToSuperview().offset(-18.autoWidth())
            make.left.equalToSuperview().offset(autoWidth(36))
            make.right.equalToSuperview().offset(autoWidth(-12.0))
//            make.height.equalTo(15.autoWidth())
        }
        
        choice.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.right.equalToSuperview().offset(autoWidth(-9.0))
            make.height.equalTo(20.autoWidth())
            make.width.equalTo(20.autoWidth())
        }
        
        lineView.snp.makeConstraints { (make) in
            make.left.equalToSuperview().offset(autoWidth(10))
            make.right.equalToSuperview()
            make.height.equalTo(0.5.autoWidth())
            make.bottom.equalToSuperview()
        }
    }
}
